package org.wmq.skyserver.mapper;

import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.wmq.skycommon.annotation.AutoFill;
import org.wmq.skycommon.enumeration.OperationType;
import org.wmq.skycommon.pojo.DTO.DishPageDTO;
import org.wmq.skycommon.pojo.VO.DishVO;
import org.wmq.skycommon.pojo.entity.Dish;

import java.util.List;

@Mapper
public interface DishMapper {
    @AutoFill(OperationType.INSERT)
    public abstract void insert(Dish dish);

    public abstract Page<DishVO> pageQuery(DishPageDTO dishPageDTO);

    @Select("select * from dish where id = #{id}")
    public abstract Dish getById(Long id);

    @Delete("delete from dish where id = #{id}")
    public abstract void deleteById(Long id);

    @AutoFill(OperationType.UPDATE)
    public abstract void update(Dish dish);

    @Select("select * from dish where category_id = {categoryId}")
    public abstract List<Dish> listByCategoryId(Long categoryId);
}
